//p3884
#include<bits/stdc++.h>
#define in(x) x=read()
using namespace std;
const int maxN=1000;
inline int read()
{
    int n=0; char ch=getchar();
    while(!isdigit(ch)) ch=getchar();
    while(isdigit(ch)) {n=n*10+ch-'0'; ch=getchar();}
    return n;
}
struct Node{int to,next,value;}edge[2*maxN];
int dis[maxN+1],vis[maxN+1],head[maxN+1],tot,box[maxN+1];
void addedge(int x,int y,int w) {edge[++tot]={y,head[x],w}; head[x]=tot;}
void SPFA(int s)
{
    queue<int>q; q.push(s);
    memset(dis,0x3f,sizeof(dis));
    memset(vis,0,sizeof(vis));
    vis[s]=1; dis[s]=0;
    while(!q.empty())
    {
        int x=q.front(); q.pop(); vis[x]=0;
        for(int i=head[x];i;i=edge[i].next)
            if(dis[edge[i].to]>dis[x]+edge[i].value)
            {
                dis[edge[i].to]=dis[x]+edge[i].value;
                if(!vis[edge[i].to])
                {
                    vis[edge[i].to]=1;
                    q.push(edge[i].to);
                }
            }
    }
}
int n,u,v,ans;
int main()
{
    in(n);
    for(int i=1;i<n;i++)
    {
        in(u); in(v);
        addedge(u,v,1); addedge(v,u,2);
    }
    in(u); in(v); SPFA(1);
    for(int i=1;i<=n;i++) box[dis[i]]++,ans=max(ans,dis[i]);
    printf("%d\n",ans+1); ans=0;
    for(int i=1;i<=n;i++) ans=max(ans,box[i]);
    printf("%d\n",ans);
    SPFA(u); printf("%d\n",dis[v]);
    return 0;
}
